/**
*	@file    /D/2.cpp
*	@date    2013-10-6 16:25
*	@author  Il'yas Garipov <logirz728@gmail.com>
*
*	Number-breaking apparatus.
*
*	@version 1.0.1
*
*	@par N is inputted, Q(N) is received.
*/


#include <stdio.h>
#include <assert.h>

#ifndef NDEBUG
#define DOUT( toprint ) printf( "\n# " toprint )	//!< Debug output, prints a plain text line preceded by #
#define DPUT( toput , x ) printf( "\n# " toput , x )//!< Debug put, a DOUT with a single variable inside
#define DLN											//!< Debug line, doesn't exist in release (with NDEBUG defined)
#define DPUTCLOSURE	DOUT("=============================================================================");\
	DPUT("FILE: %s", __FILE__ );\
	DPUT("COMPILATION DATE: %s", __DATE__ );\
	DPUT("COMPILATION TIME: %s", __TIME__ )//!< Put a closing statement, complete with datestamp and finename.
#else
#define DOUT
#define DPUT
#define DLN if(0)
#define DPUTCLOSURE
#endif

const int MAX_N = 500;		//!< The absolute ceiling for N
int ARR[MAX_N][MAX_N] = {0};//!< The global array holding important recursion base data

/**
*	funQ - get q(n,k) which equals to how much breakdowns of n there can be with k being the ceiling for summands
*
*	@param	n	The number to break down unto unique summands
*	@param	k	The max value of such a summand
*
*	@return	q(n,k)
*
*/
int funq( int n, int k )
{
	if( ( n > 0 ) && ( k > 0 ) && ( ARR[n][k] > 0 ) )
		return ARR[n][k];

	if( ( n < 0 ) || ( k < 0 ) )
		return 0;

	else if( ( n <= 1 ) && ( k > 0 ) )
		return 1;

	ARR[n][k] = ( funq( n - k, k - 1 ) + funq( n, k - 1 ) );
	return ARR[n][k];
}

int main()
{
	DOUT( "=======================2007, 1 semester assignment, 2-D=======================" );
	DOUT( "==============================================================================" );
	DOUT( "Please enter N which will be broken down into sums:" );
	DOUT( ">" );

	int N = 0;
	long int out = 0;
	int chk = scanf( "%d", &N );
	DLN assert( ( "Garbage-less input" , chk == 1 ) );
	DLN assert( ( "The global array was successfully created?", ARR != NULLs ) );

	out = funq( N, N );

	printf( "%ld", out );

	DPUTCLOSURE;
	return 0;
}


